package runing;

import api.PersonForCglib;
import api.TestPerson;
import net.sf.cglib.core.DebuggingClassWriter;
import net.sf.cglib.proxy.Enhancer;
import proxy.PersonMethonInterceptor;

/**
 * @author shenhan
 * @create 2020/1/17 10:21
 * @description
 */
public class TestPersonProxy {
    public static void main(String[] args) {
//        System.setProperty(DebuggingClassWriter.DEBUG_LOCATION_PROPERTY, "C:\\Users\\shenhan\\Desktop\\office");
        Enhancer enhancer = new Enhancer();
        enhancer.setSuperclass(TestPerson.class);
        enhancer.setCallback(new PersonMethonInterceptor());
        PersonForCglib proxy = (PersonForCglib) enhancer.create();
        proxy.eat("北京烤鸭");
    }
}
